package daobeauty.interceptor.returntype.handler.impl;

import java.util.LinkedList;
import java.util.List;

import daobeauty.interceptor.returntype.handler.ReturnTypeHandler;

/**
 * ReturnTypeHandler for methods returning a LinkedList.
 * 
 * @author M. Serhat Cinar
 *
 */
public class LinkedListReturnType implements ReturnTypeHandler<LinkedList> {

	/**
	 * Creates a new LinkedList and adds all elements of the List to the LinkedList.
	 * 
	 * @see daobeauty.interceptor.returntype.handler.ReturnTypeHandler#convert(java.util.List)
	 */
	@SuppressWarnings("unchecked")
	public LinkedList convert(List result) {
		return new LinkedList(result);
	}

	/**
	 * Creates a new LinkedList and adds the Object to the LinkedList.
	 * 
	 * @see daobeauty.interceptor.returntype.handler.ReturnTypeHandler#convert(java.lang.Object)
	 */
	@SuppressWarnings("unchecked")
	public LinkedList convert(Object result) {
		final LinkedList list = new LinkedList();
		list.add(result);
		return list;
	}
}
